//引入路由
import { createRouter, createWebHashHistory } from "vue-router";
//配登入
//热更新 引入路径必须大小写相同
let login = () =>
  import(/*webpackChunkName:"login"*/ "@/pages/login/index.vue");
//配置home
let home = () => import(/*webpackChunkName:"home"*/ "@/pages/Home/index.vue");

//配置404
let page404 = ()=>import(/*webpackChunkName:"home"*/ "@/components/404/index.vue");
//定义路由
const routes = [
  {
    path: "/login",
    name: "login",
    component: login,
  },
  {
    path: "/home",
    name: "home",
    component: home,
  },
  {
    path: "/",
    redirect: "/login",
  },
  {
    path: "/404", 
    component: page404,
  },
  {
    path:"/:pathMatch(.*)",
    redirect:"/404"
  }
];

const router = createRouter({
  history: createWebHashHistory(),
  routes,
});

export default router;
